import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";

const root = ReactDOM.createRoot(
  document.getElementById("root") as HTMLElement
);

root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

// 高级类型

// 类型断言

// document.addEventListener("click", (e) => {
//   const tar = e.target;

//   if (tar) {
//     if ((tar as HTMLElement).className === "delete") {
//       (tar as HTMLElement).classList.add("active");
//     }
//   }
// });

// // 联合类型

// let s: number | boolean = 1;

// s = true;

// // 交叉类型（Intersection Types）

// // let s1: number & boolean = 1

// interface Person {
//   name: string;
//   age: number;
// }

// interface Person1 {
//   like: string[];
//   height: number;
// }

// const o: Person & Person1 = {
//   name: "张三",
//   age: 18,
//   like: ["123"],
//   height: 180,
// };

// const o1: Person | Person1 = {
//   name: "张三",
//   age: 18,
//   like: ["123"],
//   height: 180,
// };

// console.log(o, o1);

// // 类型保护
// let ss: Person | null = null;

// // typeof
// if (ss) {
//   // Person
// } else {
//   // null
// }

// // 类型推论

// let x = 1;

// let arr = [1, 2, 3, true, "123", { name: "张三" }];
